package com.shop.admin.controller;

import com.shop.Result.LdbzResult;
import com.shop.admin.service.AdminUserService;
import com.shop.pojo.LdbzAdminUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@RestController
@RequestMapping("/admin/user/service")
public class AdminUserController {

    private static final Logger logger = LoggerFactory.getLogger(AdminUserController.class);

    @Autowired
    private AdminUserService adminUserService;

    @RequestMapping(value="/editAdminUser/{id}" , method = RequestMethod.GET)
    public LdbzResult editAdminUser(@PathVariable("id")long id , Model model) {
        return adminUserService.selectByKey(id);
    }

    @RequestMapping(value="/getAdminUserPage" , method = RequestMethod.GET)
    public LdbzResult getAdminUserPage(LdbzAdminUser entity , int page , int limit) {
        return adminUserService.getAdminUserPage(entity, page, limit);
    }

    @RequestMapping(value="/selectByKey/{id}" , method = RequestMethod.GET)
    public LdbzResult selectByKey(@PathVariable("id")long id) {
        return adminUserService.selectByKey(id);
    }

    @RequestMapping(value="/deleteByKey/{id}" , method = RequestMethod.GET)
    public LdbzResult deleteByKey(@PathVariable("id")String id) {
        return adminUserService.deleteByKey(id);
    }

    @RequestMapping(value="/insertByEntity" , method = RequestMethod.GET)
    public LdbzResult insertByEntity(LdbzAdminUser entity) {
        return adminUserService.insertByEntity(entity);
    }

    @RequestMapping(value="/updateByKey" , method = RequestMethod.GET)
    public LdbzResult updateByKey(LdbzAdminUser entity) {
        return adminUserService.updateByKey(entity);
    }
}
